﻿using Bmz.MongoDb.Entities;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.IdGenerators;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Bmz.HangFire.Web.Models
{
    public enum CounselorTypeEnum
    {
        /// <summary>
        /// 塔罗师
        /// </summary>
        Tarrowor = 0,
        /// <summary>
        /// 占星师
        /// </summary>
        Stargazer = 1,
        /// <summary>
        /// 心理咨询师
        /// </summary>
        PsychologicalConsultant = 2
    }

    /// <summary>
    /// 开通服务状态：1初始状态，2审核中，3已通过,4未通过
    /// </summary>
    public enum CounselorServiceStatusEnum
    {
        /// <summary>
        /// 初始状态
        /// </summary>
        InitStatus = 1,
        /// <summary>
        /// 审核中
        /// </summary>
        Checking = 2,
        /// <summary>
        /// 已通过
        /// </summary>
        Pass = 3,
        /// <summary>
        /// 未通过
        /// </summary>
        NoPass = 4
    }

    public class KeyValueModel
    {
        public string Key { get; set; }
        public int Value { get; set; }
    }

    /// <summary>
    /// 咨询师信息表
    /// </summary>
    public partial class CounselorInfo : IEntity
    {
        [BsonId(IdGenerator = typeof(ObjectIdGenerator))]
        [JsonIgnore]
        public ObjectId Id { get; set; }

        [BsonIgnore]
        [JsonProperty(PropertyName = "Id")]
        public string JsonId
        {
            get { return Id.ToString(); }
            set { Id = ObjectId.Parse(value); }
        }
        /// <summary>
        /// 用户编号
        /// </summary>
        public int UserId { get; set; }

        /// <summary>
        /// 总星级
        /// </summary>
        public double TotalStarLevel { get; set; }

        /// <summary>
        /// 总评价标签
        /// </summary>
        public List<KeyValueModel> EvaluateTags { get; set; }

        /// <summary>
        /// 评价个数
        /// </summary>
        public int TotalEvaluteCount { get; set; }

        /// <summary>
        /// 已解答个数 在订单完成时累计
        /// </summary>
        public int TotalAnswerCount { get; set; }

        /// <summary>
        /// 擅长标签
        /// </summary>
        public List<string> SkillTags { get; set; }

        /// <summary>
        /// 开通服务状态：1初始状态，2审核中，3已通过,4未通过
        /// </summary>
        public CounselorServiceStatusEnum ServiceStatus { get; set; }

        /// <summary>
        /// 审核描述
        /// </summary>
        public string CheckDesc { get; set; }

        /// <summary>
        /// 申请时间
        /// </summary>
        public DateTime? ApplyDatetime { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? CheckDatetime { get; set; }

        /// <summary>
        /// 每个时间最大接单量
        /// </summary>
        public int? MaxCountEveryTime { get; set; }

        /// <summary>
        /// 个人简介
        /// </summary>
        public string PersonalDesc { get; set; }

        /// <summary>
        /// 门店地址
        /// </summary>
        public string StoreAddress { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 占卜师类型列表，0塔罗师，1占星师，2心理咨询师
        /// </summary>
        public List<CounselorTypeEnum> CounselorTypes { get; set; }


        public bool IsTransient()
        {
            return false;
        }
    }

    public class ExternalLoginConfirmationViewModel
    {
        [Required]
        [Display(Name = "User name")]
        public string UserName { get; set; }
    }

    public class ManageUserViewModel
    {
        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Current password")]
        public string OldPassword { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "New password")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm new password")]
        [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }

    public class LoginViewModel
    {
        [Required]
        [Display(Name = "User name")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Display(Name = "Remember me?")]
        public bool RememberMe { get; set; }
    }

    public class RegisterViewModel
    {
        [Required]
        [Display(Name = "User name")]
        public string UserName { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }
}
